This file is part of the supplementary material of the manuscript: Didino, D., Brandtner, M., & Knops, A. (2021). No influence of masked priming on the multiplication fact retrieval in a result verification task.
This script reports the analysis for experiment 1.
Dataset loaded: exp1_data.rds (data of result verification task)
Load libraries, my functions (my_functions folder) and data (data/processed folder):
library('ggpubr')
#> Loading required package: ggplot2
library('here')
#> here() starts at D:/mult_prime
library('kableExtra')
# library('knitr')
library('plotly')
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
library('ggridges')
library('tidyverse')
#> -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
#> v tibble 3.1.0 v dplyr 1.0.5
#> v tidyr 1.1.3 v stringr 1.4.0
#> v readr 1.4.0 v forcats 0.5.1
#> v purrr 0.3.4
#> -- Conflicts ------------------------------------------ tidyverse_conflicts() --
#> x dplyr::filter() masks plotly::filter(), stats::filter()
#> x dplyr::group_rows() masks kableExtra::group_rows()
#> x dplyr::lag() masks stats::lag()
library('BayesFactor')
#> Loading required package: coda
#> Loading required package: Matrix
#>
#> Attaching package: 'Matrix'
#> The following objects are masked from 'package:tidyr':
#>
#> expand, pack, unpack
#> ************
#> Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
#>
#> Type BFManual() to open the manual.
#> ************
# Load my functions
source(here('funcs', 'load_my_functions.R'))
# Load data
exp1 <- readRDS(here('data', 'processed', 'exp1_data.rds'))
Exclude outliers
exp1 <-
exp1 %>%
filter(outlier == FALSE)
exp1_dRT <-
exp1 %>%
return_delta_RT(.,
y_col = RT,
cols_to_group = c('sj', 'problem_size'),
cols_to_subtract = c('prime_cond'),
neutral_cond = 'neutral')
#> `summarise()` has grouped output by 'sj', 'problem_size'. You can override using the `.groups` argument.
dens_RT <-
ggplot(exp1, aes(RT)) +
geom_density() +
stat_function(fun = dnorm,
args = list(mean = mean(exp1$RT), sd = sd(exp1$RT)),
color = 'blue') +
ggtitle('')
dens_dRT <-
ggplot(exp1_dRT, aes(dRT)) +
geom_density() +
stat_function(fun = dnorm,
args = list(mean = mean(exp1_dRT$dRT), sd = sd(exp1_dRT$dRT)),
color = 'blue') +
ggtitle('')
ggarrange(dens_RT,
dens_dRT,
ncol = 2,
nrow = 1,
labels = c('RT', 'delta RT'))
Table with RTs mean, standard deviation and standard error (aggregated on subject and condition):
# Calculate statistics
exp1_stats <-
exp1_dRT %>%
return_stats(c('problem_size', 'cond'),
DV = 'dRT')
#> `summarise()` has grouped output by 'sj', 'problem_size'. You can override using the `.groups` argument.
#> `summarise()` has grouped output by 'problem_size'. You can override using the `.groups` argument.
# Show results
exp1_stats %>%
make_table('Statistics (prime condition by problem size)')
| problem_size | cond | N_sj | Mean | SD | SE |
|---|---|---|---|---|---|
| large | identity | 28 | -42.73 | 53.06 | 10.03 |
| large | neigh_con | 28 | 25.05 | 52.21 | 9.87 |
| large | neigh_inc | 28 | 47.45 | 45.98 | 8.69 |
| large | unrel_con | 28 | 5.33 | 55.49 | 10.49 |
| large | unrel_inc | 28 | 48.06 | 63.47 | 11.99 |
| small | identity | 28 | -37.17 | 44.19 | 8.35 |
| small | neigh_con | 28 | 22.58 | 55.73 | 10.53 |
| small | neigh_inc | 28 | 23.96 | 45.06 | 8.52 |
| small | unrel_con | 28 | 49.62 | 56.39 | 10.66 |
| small | unrel_inc | 28 | 39.83 | 51.70 | 9.77 |
RTs distribution across prime conditions:
plot_1 <-
exp1_dRT %>%
ggplot(aes(dRT, fill = cond)) +
geom_density(alpha = 0.6) +
facet_wrap(~ problem_size, ncol = 2)
ggplotly(plot_1)
exp1_dRT %>%
ggplot(aes(x = dRT, y = cond, fill = stat(x))) +
geom_density_ridges_gradient(scale = 3) +
scale_fill_viridis_c(name = 'RTs', option = 'C') +
labs(y = 'Prime condition') +
facet_wrap(~ problem_size, ncol = 2)
#> Picking joint bandwidth of 23.9
#> Picking joint bandwidth of 22.2
Bayes factors are computer with the package BayesFactor.
tribble(
~BF, ~Evidence,
'0-3', 'Anectodal',
'3-10', 'Moderate',
'10-30', 'Strong',
'30-100', 'Very_strong',
'>100', 'Decisive') %>%
make_table('Bayes factor interpretation')
| BF | Evidence |
|---|---|
| 0-3 | Anectodal |
| 3-10 | Moderate |
| 10-30 | Strong |
| 30-100 | Very_strong |
| >100 | Decisive |
exp1_bf <-
exp1_dRT %>%
group_by(problem_size, cond) %>%
nest() %>%
mutate(
# "DV" is the column with the means returned by "return_means()"
BF_test = map(data,
~ttestBF(x = .$dRT,
mu = 0)),
BF_value = map(BF_test,
~extractBF(.) %>%
tibble %>%
select(bf, error))
) %>%
unnest(BF_value)
exp1_bf
#> # A tibble: 10 x 6
#> # Groups: problem_size, cond [10]
#> problem_size cond data BF_test bf error
#> <chr> <chr> <list> <list> <dbl> <dbl>
#> 1 large identity <tibble[,2] [28 x 2]> <BFBysFct> 129. 0.0000000985
#> 2 large neigh_con <tibble[,2] [28 x 2]> <BFBysFct> 2.93 0.0000000914
#> 3 large neigh_inc <tibble[,2] [28 x 2]> <BFBysFct> 2388. 0.0000000204
#> 4 large unrel_con <tibble[,2] [28 x 2]> <BFBysFct> 0.226 0.0000779
#> 5 large unrel_inc <tibble[,2] [28 x 2]> <BFBysFct> 70.5 0.0000000384
#> 6 small identity <tibble[,2] [28 x 2]> <BFBysFct> 203. 0.000000107
#> 7 small neigh_con <tibble[,2] [28 x 2]> <BFBysFct> 1.43 0.000000112
#> 8 small neigh_inc <tibble[,2] [28 x 2]> <BFBysFct> 5.03 0.0000000798
#> 9 small unrel_con <tibble[,2] [28 x 2]> <BFBysFct> 334. 0.0000000914
#> 10 small unrel_inc <tibble[,2] [28 x 2]> <BFBysFct> 83.2 0.0000000561
exp1_bf <-
exp1_bf %>%
select(problem_size, cond, bf) %>%
rename(BF_10 = bf) %>%
mutate(
BF_01 = 1 / BF_10
)
# Show results
exp1_bf %>%
make_table('Bayes factor')
| problem_size | cond | BF_10 | BF_01 |
|---|---|---|---|
| large | identity | 129.00 | 0.01 |
| large | neigh_con | 2.93 | 0.34 |
| large | neigh_inc | 2388.08 | 0.00 |
| large | unrel_con | 0.23 | 4.43 |
| large | unrel_inc | 70.51 | 0.01 |
| small | identity | 203.26 | 0.00 |
| small | neigh_con | 1.43 | 0.70 |
| small | neigh_inc | 5.03 | 0.20 |
| small | unrel_con | 334.14 | 0.00 |
| small | unrel_inc | 83.18 | 0.01 |
Create a single data frame with dRT and mean RT (a data point for each subject, problem size and prime condition)
# Mean RT by subject
exp1_meanRT_sj <-
exp1 %>%
return_stats(c('sj', 'problem_size', 'cond'),
DV = 'RT') %>%
select(sj, problem_size, prime_cond, Mean) %>%
rename(cond = prime_cond) %>%
filter(cond != 'neutral')
#> `summarise()` has grouped output by 'sj', 'problem_size'. You can override using the `.groups` argument.
#> `summarise()` has grouped output by 'sj', 'problem_size'. You can override using the `.groups` argument.
# Join data frames
exp1_dRT_meanRT <-
full_join(exp1_dRT,
exp1_meanRT_sj,
by = c('sj', 'problem_size', 'cond'))
Plot for large problems
exp1_dRT_meanRT %>%
filter(problem_size == 'large') %>%
ggplot(aes(Mean, dRT)) +
geom_point() +
geom_hline(yintercept = 0,
linetype = 'dashed',
color = 'red',
size = 0.5) +
facet_wrap(~ cond)
Plot for small problems
exp1_dRT_meanRT %>%
filter(problem_size == 'small') %>%
ggplot(aes(Mean, dRT)) +
geom_point() +
geom_hline(yintercept = 0,
linetype = 'dashed',
color = 'red',
size = 0.5) +
facet_wrap(~ cond)
xfun::session_info()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19044)
#>
#> Locale:
#> LC_COLLATE=English_United Kingdom.1252
#> LC_CTYPE=English_United Kingdom.1252
#> LC_MONETARY=English_United Kingdom.1252
#> LC_NUMERIC=C
#> LC_TIME=English_United Kingdom.1252
#>
#> Package version:
#> abind_1.4-5 askpass_1.1 assertthat_0.2.1
#> backports_1.2.1 base64enc_0.1.3 BayesFactor_0.9.12-4.2
#> BH_1.75.0.0 blob_1.2.1 boot_1.3.27
#> broom_0.7.6 bslib_0.2.4 callr_3.6.0
#> car_3.0-10 carData_3.0-4 cellranger_1.1.0
#> cli_2.4.0 clipr_0.7.1 coda_0.19-4
#> colorspace_2.0-0 compiler_4.0.5 conquer_1.0.2
#> contfrac_1.1.12 corrplot_0.84 cowplot_1.1.1
#> cpp11_0.2.7 crayon_1.4.1 crosstalk_1.1.1
#> curl_4.3 data.table_1.14.0 DBI_1.1.1
#> dbplyr_2.1.1 deSolve_1.28 digest_0.6.27
#> dplyr_1.0.5 dtplyr_1.1.0 ellipsis_0.3.1
#> elliptic_1.4.0 evaluate_0.14 fansi_0.4.2
#> farver_2.1.0 forcats_0.5.1 foreign_0.8-81
#> fs_1.5.0 gargle_1.1.0 generics_0.1.0
#> ggplot2_3.3.5 ggpubr_0.4.0 ggrepel_0.9.1
#> ggridges_0.5.3 ggsci_2.9 ggsignif_0.6.1
#> glue_1.4.2 googledrive_1.0.1 googlesheets4_0.3.0
#> graphics_4.0.5 grDevices_4.0.5 grid_4.0.5
#> gridExtra_2.3 gtable_0.3.0 gtools_3.8.2
#> haven_2.3.1 here_1.0.1 highr_0.8
#> hms_1.0.0 htmltools_0.5.1.1 htmlwidgets_1.5.3
#> httr_1.4.2 hypergeo_1.2.13 ids_1.0.1
#> isoband_0.2.4 jquerylib_0.1.3 jsonlite_1.7.2
#> kableExtra_1.3.4 knitr_1.33 labeling_0.4.2
#> later_1.1.0.1 lattice_0.20-41 lazyeval_0.2.2
#> lifecycle_1.0.0 lme4_1.1.26 lubridate_1.7.10
#> magrittr_2.0.1 maptools_1.1.1 markdown_1.1
#> MASS_7.3.53.1 Matrix_1.3-2 MatrixModels_0.5-0
#> matrixStats_0.58.0 methods_4.0.5 mgcv_1.8.34
#> mime_0.10 minqa_1.2.4 modelr_0.1.8
#> munsell_0.5.0 mvtnorm_1.1-1 nlme_3.1.152
#> nloptr_1.2.2.2 nnet_7.3.15 numDeriv_2016.8.1.1
#> openssl_1.4.3 openxlsx_4.2.3 parallel_4.0.5
#> pbapply_1.4-3 pbkrtest_0.5.1 pillar_1.6.0
#> pkgconfig_2.0.3 plotly_4.9.3 plyr_1.8.6
#> polynom_1.4.0 prettyunits_1.1.1 processx_3.5.1
#> progress_1.2.2 promises_1.2.0.1 ps_1.6.0
#> purrr_0.3.4 quantreg_5.85 R6_2.5.0
#> rappdirs_0.3.3 RColorBrewer_1.1.2 Rcpp_1.0.6
#> RcppArmadillo_0.10.2.2.0 RcppEigen_0.3.3.9.1 readr_1.4.0
#> readxl_1.3.1 rematch_1.0.1 rematch2_2.1.2
#> reprex_2.0.0 rio_0.5.26 rlang_0.4.10
#> rmarkdown_2.7 rprojroot_2.0.2 rstatix_0.7.0
#> rstudioapi_0.13 rvest_1.0.0 sass_0.3.1
#> scales_1.1.1 selectr_0.4.2 sp_1.4.5
#> SparseM_1.81 splines_4.0.5 statmod_1.4.35
#> stats_4.0.5 stringi_1.5.3 stringr_1.4.0
#> svglite_2.0.0 sys_3.4 systemfonts_1.0.2
#> tibble_3.1.0 tidyr_1.1.3 tidyselect_1.1.0
#> tidyverse_1.3.1 tinytex_0.31 tools_4.0.5
#> utf8_1.2.1 utils_4.0.5 uuid_0.1.4
#> vctrs_0.3.7 viridisLite_0.3.0 webshot_0.5.2
#> withr_2.4.1 xfun_0.22 xml2_1.3.2
#> yaml_2.2.1 zip_2.1.1